import config from '../config'


let fns = {}

// 登陆
fns.login = (params, success, fail) => {

  dd.httpRequest({

    url: config.domain + '/login',
    method: 'POST',
    dataType: 'json',
    data: params,

    success: (res) => {
      dd.hideLoading();
      if (res.data.code == 0) {
        success && success(res)
      } else {
        fail && fail(res.data.message)
      }
    },

    fail: () => {
      dd.hideLoading();
      fail && fail('网络异常')
    }

  });

}

module.exports = fns
